001 /* 002 * Copyright 2005-2006 Stephen J. McConnell. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.metro; 020 021 import net.dpml.component.ControlException; 022 023 import net.dpml.lang.UnknownKeyException; 024 025 /** 026 * Local interface through which a component implementation may 027 * interact with subsidary parts. 028 * 029 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a> 030 * @version 1.0.0 031 */ 032 public interface PartsManager 033 { 034 /** 035 * Return the array of keys used to identify internal parts. 036 * @return the part key array 037 */ 038 String[] getKeys(); 039 040 /** 041 * Return a local component handler. 042 * @param key the internal part key 043 * @return the local component handler 044 * @exception UnknownKeyException the key is not recognized 045 */ 046 ComponentHandler getComponentHandler( String key ) throws UnknownKeyException; 047 048 /** 049 * Return an array of all component handlers. 050 * @return the local component handler array 051 */ 052 ComponentHandler[] getComponentHandlers(); 053 054 /** 055 * Return an array of component handlers assignable to the supplied service. 056 * @param service the service class to match against 057 * @return the local component handler array 058 */ 059 ComponentHandler[] getComponentHandlers( Class service ); 060 061 /** 062 * Return the commissioned state of the part collection. 063 * @return true if commissioned else false 064 */ 065 boolean isCommissioned(); 066 067 /** 068 * Initiate the oprdered activation of all internal parts. 069 * @exception ControlException if an activation error occurs 070 */ 071 void commission() throws ControlException; 072 073 /** 074 * Initiate deactivation of all internal parts. 075 */ 076 void decommission(); 077 } 078